package cn.com.pxto.service.impl;

import java.util.List;

import cn.com.pxto.commons.SearchParam;
import cn.com.pxto.dao.DicDAO;
import cn.com.pxto.model.Dic;
import cn.com.pxto.service.DicManager;

/**
 * @author Gauss Cheung
 *
 * Jul 7, 2006
 */
public class DicManagerImpl implements DicManager {
	private DicDAO dicDAO;
	
	/*
	 * set by spring ioc
	 */
	public void setDicDAO(DicDAO dicDAO) {
		this.dicDAO = dicDAO;
	}

	/*
	 * @see cn.com.iactive.service.DicManager#getDicsByType(java.lang.String)
	 */
	public List getDicsByType(String type) {
		return dicDAO.getDicsByType(type);
	}
	/**
	 * ����Dic
	 */
	public List listDic(SearchParam[] params){
		return dicDAO.listDic(params);
	}
	public void modifyDic(Dic dic){
		dicDAO.modifyDic(dic);
	}
	public void deleteDic(Integer id){
		dicDAO.deleteDic(id);
	}
	public int getMaxIdForChannelType(String classSid){
		return dicDAO.getMaxIdForChannelType(classSid);
	}
	public Dic getDic(Integer id){
		return dicDAO.getDic(id);
	}
	/**
	 * 
	 */
	public Dic getDicByParams(){
		SearchParam[] params = new SearchParam[]{new SearchParam("type","discount",SearchParam.SEARCH_PARAM_TYPE_STRING_DISTINCT)};
		List list = dicDAO.listDic(params);
		Dic dic = null;
		if(list!=null&&list.size()>0){
			dic = (Dic)list.get(0);
		}
		return dic;
	}
	public List listDicById(SearchParam[] params,String strId){
		return dicDAO.listDicById(params,strId);
	}
}
